package pl.devfest;

import java.sql.SQLException;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.TextView;

public class MainActivity extends GeneralActivity implements OnClickListener {
	private TextView buttonTasks, buttonWorkPlan, buttonReports,
			buttonWorkingMode;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.main);

		buttonWorkingMode = (TextView) findViewById(R.id.working_mode_button);
		buttonWorkingMode.setOnClickListener(this);

		buttonTasks = (TextView) findViewById(R.id.tasks_button);
		buttonTasks.setOnClickListener(this);

		buttonWorkPlan = (TextView) findViewById(R.id.work_plan_button);
		buttonWorkPlan.setOnClickListener(this);

		buttonReports = (TextView) findViewById(R.id.reports_button);
		buttonReports.setOnClickListener(this);

		try {
			FakeTaskCreator.createFakeTasks(getHelper());
		} catch (SQLException e) {
			e.printStackTrace();
		}
	}

	@Override
	public void onClick(View v) {
		Intent intent = null;

		switch (v.getId()) {
		case R.id.working_mode_button:
			intent = new Intent(this,
					pl.devfest.working.WorkingModeActivity.class);
			break;
		case R.id.tasks_button:
			intent = new Intent(this, pl.devfest.task.TasksActivity.class);
			break;
		case R.id.work_plan_button:
			intent = new Intent(this, pl.devfest.work.WorkPlanActivity.class);
			break;
		case R.id.reports_button:
			intent = new Intent(this, pl.devfest.report.ReportsActivity.class);
			break;
		}

		if (intent != null)
			startActivity(intent);
	}
}
